package com.winning.sercurity.controller;

import com.winning.sercurity.dto.AlgorithmSaveDto;
import com.winning.sercurity.service.AlgorithmManageService;
import com.winning.sercurity.vo.AlgorithmParamQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;
import javax.validation.Valid;
import java.util.List;

/**
 * @classname: AlgorithmManageController
 * @description: 算法管理相关接口.
 * @author: suboyang
 * @create: 2022/10/17-15:36
 **/
@Slf4j
@RestController
@RequestMapping("/algorithmManage")
@Api("算法管理")
public class AlgorithmManageController {

    @PostConstruct
    public void init(){
        System.out.println(123);
    }

    @Autowired
    private AlgorithmManageService algorithmManageService;

    @PostMapping("/updateParam")
    @ApiOperation("算法参数更新")
    public ResponseEntity<Boolean> updateParam(@Valid @RequestBody AlgorithmSaveDto algorithmSaveDto){
        return ResponseEntity.ok(algorithmManageService.updateParam(algorithmSaveDto));
    }
    @PostMapping("/queryParam")
    @ApiOperation("算法参数查询")
    public ResponseEntity<List<AlgorithmParamQueryVo>> queryParam(){
        return ResponseEntity.ok(algorithmManageService.queryParam());
    }


}
